class CartItem < ActiveRecord::Base
  belongs_to :product
  belongs_to :cart

  def total_cost
    product.price * quantity
  end

  def product_in_stock?
    product.stock >= quantity
  end
end
